<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : albumManage.xsl
    Created on : April 1, 2013, 9:16 PM
    Author     : tiwtiger
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:s="http://xml.netbeans.org/schema/album"
exclude-result-prefixes="s">
    <xsl:output method="html"/>

    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
    <xsl:template match="/">
        <html>
            <body>
                <xsl:apply-templates/>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="s:Albums">
        <h1>Album Manage</h1>
        <br/>
        <input type="button" value="Add new Album"/>
        <input type="text" value="Search here"/>
        <table border="1" width="100%">
            <tr bgcolor="#9acd32">
                <td>Album ID</td>
                <td>Title</td>
                <td>Year</td>
                <td>Description</td>
                <td>Artist Name</td>
                <td>Date Created</td>
                <td>Views</td>
                <td>Album cover</td>
                <td>Songs</td>
                <td>Update</td>
                <td>Delete</td>
            </tr>
            <xsl:for-each select="s:Album">
                <tr>
                    <td>
                        <xsl:value-of select="s:AlbumID"/>
                    </td>
                    <td>
                        <xsl:value-of select="s:AlbumTitle"/>
                    </td>
                    <td>
                        <xsl:value-of select="s:Year"/>
                    </td>
                    <td>
                        <xsl:value-of select="s:AlbumDescription"/>
                    </td>
                    <td>
                        <xsl:value-of select="s:ArtistName"/>
                    </td>
                    <td>
                        <xsl:value-of select="s:AlbumDateCreated"/>
                    </td>
                    <td>
                        <xsl:value-of select="s:AlbumViews"/>
                    </td>
                    <td>
<!--                        <xsl:value-of select="s:AlbumCoverSRC"/>-->
                        <img alt=""  src="http://localhost:8084/M4E/db/{s:ArtistName}/Album/{s:AlbumTitle}/{s:AlbumCoverSRC}"
                                width="80" height="80"/>
                    </td>
                    <td width="10%">
                        <xsl:apply-templates select="s:Songs"/>
                    </td>
                    <td>
                        <input type="button" value="Update"/>
                    </td>
                    <td>
                        <input type="button" value="Delete" onclick="deleteByID({AlbumID})"/>
                    </td>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>
    <xsl:template match="s:Songs">
        <xsl:for-each select="s:Song">
            <li><xsl:value-of select="s:SongTitle"/></li>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
